package cn.cf.kxx;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import cn.cf.kxx.fram.OnActivityInteractionListener;
import cn.cf.kxx.fram.OnFragmentInteractionListener;

public class PoliceActivity extends Fragment implements View.OnClickListener , OnFragmentInteractionListener {
    @Override
    public void onRefrashString(String type) {
    }

    @Override
    public void onRefrashValve(int status) {

    }
    @Override
    public void onRefrashValues(Object obj) {

    }
    Button goHome;
    View contentView;

    public static PoliceActivity newInstance(Bundle args) {
        PoliceActivity fragment = new PoliceActivity();
        fragment.setArguments(args);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (contentView == null) {
            contentView = inflater.inflate(R.layout.activity_police, container, false);
        } else {
            ViewGroup parent = (ViewGroup) contentView.getParent();
            if (parent != null) {
                parent.removeView(contentView);
            }
        }
        goHome = contentView.findViewById(R.id.goHome);
        goHome.setOnClickListener(this);
        return contentView;
    }

    OnActivityInteractionListener onActivityInteractionListener;
    @Override
    public void onAttach(@NonNull Context context) {
        super.onAttach(context);
        onActivityInteractionListener = (OnActivityInteractionListener) context;
    }
    @Override
    public void onClick(View v) {
        if(v.getId() == R.id.goHome){
            onActivityInteractionListener.bakeFragment();
        }
    }
}